package pl.vanta.mjuzik2.impl.player.formats.mp3;

import javax.sound.sampled.AudioFileFormat;

import javazoom.spi.mpeg.sampled.file.MpegFileFormatType;
import pl.vanta.mjuzik2.api.FileInfo;
import pl.vanta.mjuzik2.impl.player.formats.AbstractFormat;

public class Mp3Format extends AbstractFormat
{
	@Override
	public String getDescription()
	{
		return "MP3 files";
	}

	@Override
	public String[] getExtensions()
	{
		return new String[] { "mp3" };
	}

	@Override
	public FileInfo getFileInfo(AudioFileFormat aff)
	{
		if (aff.getType() == MpegFileFormatType.MP3)
		{
			Mp3FileInfo fileInfo = new Mp3FileInfo();

			if (fileInfo.load(aff))
			{
				return fileInfo;
			}

			return null;
		}

		return null;
	}
}